import requests

class Tpshop():
    # 初始化
    def __init__(self):
        self.code_url = "http://10.211.55.6/index.php?m=Mobile&c=User&a=verify"
        self.login_url = "http://10.211.55.6/index.php?m=Mobile&c=User&a=do_login"

    # 获取验证码
    def get_code(self,session):
        reponse = session.get(url=self.code_url)
        print(reponse.headers.get("content-type"))
        return reponse

    # 退出
    def quit_driver(self, session):
        session.close()

    # 登录测试
    def test_login(self, session,username,password,verify_code):
        data = {
            "username":username,
            "password":password,
            "verify_code":verify_code
        }
        reponse = session.post(url=self.login_url,data=data)
        print(reponse.json())
        return reponse


    # def test02_login(self):
    #     data = {
    #         "username":"",
    #         "password":"123456",
    #         "verify_code":"8888"
    #     }
    #     reponse = self.session.post(url=self.login_url,json=data)
    #     print(reponse.json())
    #     return reponse
    #
    #
    # def test03_login(self):
    #     data = {
    #         "username":"131123456789",
    #         "password":"123456",
    #         "verify_code":"8888"
    #     }
    #     reponse = self.session.post(url=self.login_url,json=data)
    #     print(reponse.json())
    #     return reponse
